import re

def _getMatrix():
    matrix=[]
    for i in range(3):
        line_str=input()
        num_lst=re.split('\\s+',line_str)
        #print(num_lst)
        matrix.append([eval(num) for num in num_lst])
    return matrix

def _cal(matrix):
    ans=0
    col=len(matrix[0])
    #print(col)
    for i in range(len(matrix)):
        ans+=matrix[i][i]+matrix[i][col-i-1]-(matrix[i][col-i-1] if i==col-i-1 else 0)
    return ans

print(_cal(_getMatrix()))